package com.lin.controller;

import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * ClassName:MenuChooseController
 * Package:com.lin.controller
 * Author: hellcat
 * Date: 2019/12/20
 * ♣♣♣  菜单选择(跳转)
 */
@Controller
@RequestMapping("/menu")
public class MenuChooseController {

    @RequestMapping(value = "/menuChoose", method = RequestMethod.GET)
    public String menuChoose(HttpServletRequest request, HttpSession session) {
        String menuId = request.getParameter("menuId");
        if (menuId != null) {
            session.removeAttribute("menuId");
            session.setAttribute("menuId", menuId);
            if ("Home".equals(menuId)) {
                return "redirect:/user/Index";
            }
            if ("StockReport".equals(menuId)) {
                return "redirect:/stockReport/toStockReport";
            }
            if ("PurchaseReport".equals(menuId)) {
                return "redirect:/purchaseReport/toPurchaseReport";
            }
            if ("SaleReport".equals(menuId)) {
                return "redirect:/saleReport/toSaleReport";
            }
            if ("ReduceReport".equals(menuId)) {
                return "redirect:/reduceReport/toReduceReport";
            }
            if ("DamageReport".equals(menuId)) {
                return "redirect:/damageReport/toDamageReport";
            }
            if ("Basic".equals(menuId) || "Basic1".equals(menuId)) {
                return "redirect:/basic/toBasic";
            }
            if ("Wares".equals(menuId)) {
                return "redirect:/wares/toWares";
            }
            if ("Category".equals(menuId)) {
                return "redirect:/category/toCategory";
            }
            if ("PriceChange".equals(menuId)) {
                return "redirect:/priceChange/toPriceChange";
            }
            if ("SaleOrder".equals(menuId)) {
                return "redirect:/saleOrder/toSaleOrder";
            }
            if ("DamageOrder".equals(menuId)) {
                return "redirect:/damageOrder/toDamageOrder";
            }
            if ("PurchaseOrder".equals(menuId)) {
                return "redirect:/purchaseOrder/toPurchaseOrder";
            }
            if ("ReduceOrder".equals(menuId)) {
                return "redirect:/reduceOrder/toReduceOrder";
            }

            if ("Sale".equals(menuId)) {
                return "redirect:/sale/toSale";
            }
            if ("Promotion".equals(menuId)) {
                return "redirect:/promotion/toPromotion";
            }
            if ("Staff".equals(menuId)) {
                return "redirect:/staff/toStaff";
            }
            if ("Authority".equals(menuId)) {
                return "redirect:/authority/toAuthority";
            }
            if ("Log".equals(menuId)) {
                return "redirect:/log/toLog";
            }
            if ("Store".equals(menuId)) {
                return "redirect:/store/toStore";
            }
            return "redirect:/user/Index";
        }
        return "redirect:/user/Index";
    }

}

